﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.Infra.Common;
using Sinacor.Infra.UI.Common;
using Sinacor.UI.Bovespa.Ordens.Model;
using Sinacor.UI.Bovespa.Ordens.Communication.Bovespa.Cliente.Cliente;
using System.ComponentModel;

namespace Sinacor.UI.Bovespa.Ordens.Communication.Translator
{
    public class TranslatorTelefoneResponse :
        BaseTranslator<Model.Telefone,
        TelefoneResponse,
        ModelCollection<Model.Telefone>,
        List<TelefoneResponse>>
    {
        public override Model.Telefone Translate(TelefoneResponse from)
        {
            Model.Telefone to = new Model.Telefone();
            if (from != null)
            {
                to.DDD = from.DDD;
                to.Numero = from.Numero;
                to.Ramal = from.Ramal;
                TranslatorEnumTipoTelefone tipoTelefone = new TranslatorEnumTipoTelefone();
                Sinacor.UI.Bovespa.Ordens.Model.Enum.TipoTelefone tipoTelefoneEnum = to.TipoTelefone;
                tipoTelefone.TranslateEnum(from.TipoTelefone, out tipoTelefoneEnum);
                to.TipoTelefone = tipoTelefoneEnum;
                to.Contato = from.Contato;
            }
            return to;
        }
    }
}
